var SelectMainLayer = cc.Layer.extend({
	lead:null,
	real:null,
    ctor:function () {
        this._super();
        // 加载菜单栏
        this.loadMenu();
        return true;
    },
    loadMenu:function(){
    	var noArr = ["五  ", "四  ", "三  ", "二  ", "一  "];
    	var menu = new cc.Menu();
    	menu.setPosition(0,0);
    	this.addChild(menu, 1);
    	var prev = null;
    	for(var i in expInfo){
    		var exp = expInfo[i];
    		var label = new cc.MenuItemLabel(
    				new cc.LabelTTF(noArr.pop() + exp.expName,gg.fontName,gg.fontSize),
				this.callback,this);
    		label.setAnchorPoint(0, 0.5);
    		label.setColor(cc.color(0,0,0, 200));
    		menu.addChild(label, 10, exp.expTag);	
    		label.exp = exp;
    		if(!prev){
    			label.setPosition(320,380);
    		} else {
    			this.down(prev, label, 20);
    		}
    		prev = label;
    	}
    },
    callback:function(p){
    	ch.run(p.getTag());
    },
    down:function (standard, target, margin){
    	if(!margin){
    		margin = 0;
    	}
    	var sap = standard.getAnchorPoint();
    	var ap = target.getAnchorPoint();
    	// 标准物的y - 标准物的高度 * 缩放 * 锚点y - 本身的高度 * 缩放 * (1-锚点y) - 所需间隔
    	var y = standard.y
    		- standard.height * standard.getScaleY() * sap.y
    		- target.height * (1-ap.y) * target.getScaleY() - margin;
    	target.setPosition(standard.x, y);
    }
});
